<?php
namespace app\api\controller;
use app\common\controller\CommonApi;

/**
 *  日记 - 必须登录
 *  date:  20190603
 */
class Nearby extends CommonApi{

    /**
     * [issue 发布动态]
     * @return [type] [description]
     */
    public function issue(){
        $validate = validate('common/nearby');
        if($validate->check($this->post) === false){
            $this->apiReturn(0,$validate->getError());
        }

        if(isset($this->post['image']) && trim($this->post['image']) !== ''){
            if(count(explode(',',$this->post['image'])) > 9){
                $this->apiReturn(0,'最多可上传9张图片');
            }
        }
        $this->post['user_id'] = UID;
        if(!model('common/nearby')->allowField(true)->save($this->post)){
            $this->apiReturn(0,'发布失败，请稍后再试');
        }
        $this->apiReturn(1,'发布成功');
    }

}
